/* Copyright 2009 Sony Mathew, Minneapolis MN. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */
package com.xsm.gwt.widgets.client;

/**
 * Provides the History management of ViewEvents for an application.
 * 
 * @author Sony Mathew
 */
public interface HistoryManager {

    /**
     * Puts up the first view (usually the first
     * 
     * author Sony Mathew
     */
    public abstract void first();

    /**
     * Put up your Home page.
     * 
     * author Sony Mathew
     */
    public abstract void home();

    /**
     * Forward to the next view (if any).
     * 
     * author Sony Mathew
     */
    public abstract void forward();

    /**
     * back to the previous view (if any).
     * 
     * author Sony Mathew
     */
    public abstract void back();

    /**
     * Obtain the ViewEvent to reach home.
     * 
     * author Sony Mathew
     */
    public abstract ViewEvent getHomeViewEvent();
    
    /**
     * Record this specific view event into history.
     * 
     * author Sony Mathew
     */
    public abstract void record(ViewEvent viewEvent);
    
    /**
     * Obtain the current view (last recorded).
     * Must return the Home ViewEvent if none exists.
     * 
     * author Sony Mathew
     */
    public abstract ViewEvent getCurrentViewEvent();
    
    /**
     * Change teh view to the given token.
     * 
     * author Sony Mathew
     */
    public void changeView(String changeViewToken);
    
    /**
     * Convert this view event to a token.
     * 
     * author Sony Mathew
     */
    public abstract String toToken(ViewEvent viewEvent);
    
    /**
     * Convert this history token into a ViewEvent.
     * 
     * author Sony Mathew
     */
    public abstract ViewEvent fromToken(String viewToken);
    
}